#include "graph.h"
int main()
{
    cout<<"Input 0 to construct an adjecent matrix,or an adjectnt list if other charactors imported."<<endl;
    int n;
    int flag;
    int data,weight,i,j;
    cin>>n;
    if(n==0)
    {
        GraphMatrix<int,int> matrix;
        cout<<"Add vertexes with a integer tag"<<endl;
        cout<<"Input -1 to quit adding vertexes"<<endl;
        while(1)
        {
            cin>>flag;
            if(flag==-1)
                break;
            tag.push_back(flag);
            matrix.insert(flag);
        }
        cout<<"Add edges with a integer,weight,vertex i,vertex j."<<endl;
        cout<<"If the integer is -1,the process ceases."<<endl;
        while(1)
        {
            cin>>data>>i>>j>>weight;
            if(data==-1)
                break;
            matrix.insert(0,weight,findElement(tag,i),findElement(tag,j));
        }
        matrix.listVertexes();
        matrix.listEdges();
    }
    else
    {
        GraphList<int,int> list;
        cout<<"Add vertexes with a integer tag,"<<endl;
        cout<<"Input -1 to quit adding vertexes"<<endl;
        while(1)
        {
            cin>>flag;
            if(flag==-1)
                break;
            tag.push_back(flag);
            list.insert(flag);
        }
        cout<<"Add edges with a integer,weight,vertex i,vertex j."<<endl;
        cout<<"If the integer is -1,the process ceases."<<endl;
        while(1)
        {
            cin>>data>>i>>j>>weight;
            if(data==-1)
                break;
            list.insert(data,weight,findElement(tag,i),findElement(tag,j));
        }
        list.listVertexes();
        list.listEdges();
    }

}